import org.springframework.beans.factory.BeanNameAware;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class BeanLifeComponent implements BeanNameAware {
    @Override
    public void setBeanName(String s) {
        System.out.println("执行了 BeanNameAware -> "+s);
    }

    @PostConstruct
    public void doPostConstruct() {
        System.out.println("执行了 @PostConstruct");
    }

    public void myInit() {
        System.out.println("执行了 myInit");
    }

    @PreDestroy
    public void doPreDestroy() {
        System.out.println("执行了 @PreDestroy");
    }

    public void sayHi() {
        System.out.println("使用 Bean");
    }

}
